package com.winning.pmph.ctrl;

import com.alibaba.fastjson.JSONObject;
import com.winning.pmph.utils.KnowledgeSyncUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Api(value = "类型转换接口")
@RestController
@RequestMapping("/pmph/action/kindEditor")
public class KindEditorCtrl {
    /**
     * 转换图片类型字段
     */

    @ApiOperation(value = "parseKnowledgeFieldImageType", notes = "转换图片类型字段")
    @PostMapping("parseKnowledgeFieldImageType")
    public JSONObject parseKnowledgeFieldImageType(String fieldValue) {
        String htmlStr = KnowledgeSyncUtil.parseKnowledgeFieldImageType(fieldValue);
        JSONObject result = new JSONObject();
        result.put("html", htmlStr);
        return result;
    }

    /**
     * 转换视频类型字段
     */
    @ApiOperation(value = "parseKnowledgeFieldVideoType", notes = "转换视频类型字段")
    @PostMapping("parseKnowledgeFieldVideoType")
    public JSONObject parseKnowledgeFieldVideoType(String fieldValue) {
        String htmlStr = KnowledgeSyncUtil.parseKnowledgeFieldVideoType(fieldValue);
        JSONObject result = new JSONObject();
        result.put("html", htmlStr);
        return result;
    }
    /**
     * 转换音频类型字段
     */
    @ApiOperation(value = "parseKnowledgeFieldAudioType", notes = "转换音频类型字段")
    @PostMapping("parseKnowledgeFieldAudioType")
    public JSONObject parseKnowledgeFieldAudioType(String fieldValue) {
        String htmlStr = KnowledgeSyncUtil.parseKnowledgeFieldAudioType(fieldValue);
        JSONObject result = new JSONObject();
        result.put("html", htmlStr);
        return result;
    }
}
